<!DOCTYPE html>
<html>
<head>
    <title>计划调整</title>
    #parse("sys/header.html")
    <style>
        .select-dom {
            cursor: inherit;
        }
    </style>
</head>
<body>
    <div id="rrapp" v-cloak>
        <div v-show="showList">
            <template>
                <Row :gutter="16" style="margin: 3px 0px">
                    <i-col span="11"></i-col>
                </Row>
                <Tabs @on-click="tabsPage" value="weekly" type="card">
                    <Tab-Pane label="周计划" name="weekly">
                        <table id="weekly"></table>
                    </Tab-Pane>
                    <Tab-Pane label="双周计划" name="deWeekly">
                        <table id="deWeekly"></table>
                    </Tab-Pane>
                    <Tab-Pane label="月计划" name="month">
                        <table id="month"></table>
                    </Tab-Pane>
                    <Tab-Pane label="季度计划" name="quarter">
                        <table id="quarter"></table>
                    </Tab-Pane>
                    <Tab-Pane label="半年计划" name="halfYear">
                        <table id="halfYear"></table>
                    </Tab-Pane>
                    <Tab-Pane label="年计划" name="yearpl">
                        <table id="yearpl"></table>
                    </Tab-Pane>
                </Tabs>
            </template>
        </div>
    </div>
    <script>
        var id = window.location.search.split('?')[1];
        var flg = window.location.search.split('&')[1]
        $(function () {
            $("#weekly").Grid({
                url: '../devAmPlanItem/list?planId=' + id + '&freRate=1',
                rowNum: 100,
                colModel: [
                    {label: '设备名称', name: 'devName', index:'DEV_NAME', width: 120},
                    {label: '维护部位', name: 'name', index:'NAME', width: 80},
                    {label: '维护内容', name: 'checkContent',index:'CHECK_CONTENT', width: 100},
                    {label: '维护标准', name: 'checkSt',index:'CHECK_ST', width: 100},
                    {label: '物料需求', name: 'materialRequ',index:'MATERIAL_REQU', width: 100},
                    {label: '方法手段', name: 'methodType',index: 'METHOD_TYPE', width: 120},
                    {label: '人次', name: 'perEv',index: 'PER_EV', width: 40},
                    {
                        label: '维护类型', name: 'mainType', index:'MAIN_TYPE',width: 80,
                        formatter: function (value) {
                            if (value == "" || value == "null" || value == null) {
                                return "";
                            } else {
                                return sysEnums.MAINTENPLAN_TYPE[value];
                            }
                        }
                    },
                    { label: '日期', name: 'dayNum', width: 80, index:'DAY_NUM'},
                    {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
                ]
            })
            $("#deWeekly").Grid({
                url: '../devAmPlanItem/list?planId=' + id + '&freRate=2',
                rowNum: 100,
                colModel: [
                    {label: '设备名称', name: 'devName', index:'DEV_NAME', width: 120},
                    {label: '维护部位', name: 'name', index:'NAME', width: 80},
                    {label: '维护内容', name: 'checkContent',index:'CHECK_CONTENT', width: 100},
                    {label: '维护标准', name: 'checkSt',index:'CHECK_ST', width: 100},
                    {label: '物料需求', name: 'materialRequ',index:'MATERIAL_REQU', width: 100},
                    {label: '方法手段', name: 'methodType',index: 'METHOD_TYPE', width: 120},
                    {label: '人次', name: 'perEv',index: 'PER_EV', width: 40},
                    {
                        label: '维护类型', name: 'mainType', index:'MAIN_TYPE',width: 80,
                        formatter: function (value) {
                            if (value == "" || value == "null" || value == null) {
                                return "";
                            } else {
                                return sysEnums.MAINTENPLAN_TYPE[value];
                            }
                        }
                    },
                    { label: '日期', name: 'dayNum', index:'DAY_NUM', width: 80 },
                    {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
                ]
            })
            $("#month").Grid({
                url: '../devAmPlanItem/list?planId=' + id + '&freRate=3',
                rowNum: 100,
                colModel: [
                    {label: '设备名称', name: 'devName', index:'DEV_NAME', width: 120},
                    {label: '维护部位', name: 'name', index:'NAME', width: 80},
                    {label: '维护内容', name: 'checkContent',index:'CHECK_CONTENT', width: 100},
                    {label: '维护标准', name: 'checkSt',index:'CHECK_ST', width: 100},
                    {label: '物料需求', name: 'materialRequ',index:'MATERIAL_REQU', width: 100},
                    {label: '方法手段', name: 'methodType',index: 'METHOD_TYPE', width: 120},
                    {label: '人次', name: 'perEv',index: 'PER_EV', width: 40},
                    {
                        label: '维护类型', name: 'mainType', index:'MAIN_TYPE',width: 80,
                        formatter: function (value) {
                            if (value == "" || value == "null" || value == null) {
                                return "";
                            } else {
                                return sysEnums.MAINTENPLAN_TYPE[value];
                            }
                        }
                    },
                    { label: '月份', name: 'monthNum', index:'MONTH_NUM', width: 80 },
                    { label: '日期', name: 'dayNum', index:'DAY_NUM', width: 80 },
                    {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
                ]
            })
            $("#quarter").Grid({
                url: '../devAmPlanItem/list?planId=' + id + '&freRate=4',
                rowNum: 100,
                colModel: [
                    {label: '设备名称', name: 'devName', index:'DEV_NAME', width: 120},
                    {label: '维护部位', name: 'name', index:'NAME', width: 80},
                    {label: '维护内容', name: 'checkContent',index:'CHECK_CONTENT', width: 100},
                    {label: '维护标准', name: 'checkSt',index:'CHECK_ST', width: 100},
                    {label: '物料需求', name: 'materialRequ',index:'MATERIAL_REQU', width: 100},
                    {label: '方法手段', name: 'methodType',index: 'METHOD_TYPE', width: 120},
                    {label: '人次', name: 'perEv',index: 'PER_EV', width: 40},
                    {
                        label: '维护类型', name: 'mainType', index:'MAIN_TYPE',width: 80,
                        formatter: function (value) {
                            if (value == "" || value == "null" || value == null) {
                                return "";
                            } else {
                                return sysEnums.MAINTENPLAN_TYPE[value];
                            }
                        }
                    },
                    { label: '月份', name: 'monthNum', index:'MONTH_NUM', width: 80 },
                    { label: '日期', name: 'dayNum', index:'DAY_NUM', width: 80 },
                    {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
                ]
            })
            $("#halfYear").Grid({
                url: '../devAmPlanItem/list?planId=' + id + '&freRate=5',
                rowNum: 100,
                colModel: [
                    {label: '设备名称', name: 'devName', index:'DEV_NAME', width: 120},
                    {label: '维护部位', name: 'name', index:'NAME', width: 80},
                    {label: '维护内容', name: 'checkContent',index:'CHECK_CONTENT', width: 100},
                    {label: '维护标准', name: 'checkSt',index:'CHECK_ST', width: 100},
                    {label: '物料需求', name: 'materialRequ',index:'MATERIAL_REQU', width: 100},
                    {label: '方法手段', name: 'methodType',index: 'METHOD_TYPE', width: 120},
                    {label: '人次', name: 'perEv',index: 'PER_EV', width: 40},
                    {
                        label: '维护类型', name: 'mainType', index:'MAIN_TYPE',width: 80,
                        formatter: function (value) {
                            if (value == "" || value == "null" || value == null) {
                                return "";
                            } else {
                                return sysEnums.MAINTENPLAN_TYPE[value];
                            }
                        }
                    },
                    { label: '月份', name: 'monthNum', index:'MONTH_NUM', width: 80 },
                    { label: '日期', name: 'dayNum', index:'DAY_NUM', width: 80 },
                    {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
                ]
            })
            $("#yearpl").Grid({
                url: '../devAmPlanItem/list?planId=' + id + '&freRate=6',
                rowNum: 100,
                colModel: [
                    {label: '设备名称', name: 'devName', index:'DEV_NAME', width: 120},
                    {label: '维护部位', name: 'name', index:'NAME', width: 80},
                    {label: '维护内容', name: 'checkContent',index:'CHECK_CONTENT', width: 100},
                    {label: '维护标准', name: 'checkSt',index:'CHECK_ST', width: 100},
                    {label: '物料需求', name: 'materialRequ',index:'MATERIAL_REQU', width: 100},
                    {label: '方法手段', name: 'methodType',index: 'METHOD_TYPE', width: 120},
                    {label: '人次', name: 'perEv',index: 'PER_EV', width: 40},
                    {
                        label: '维护类型', name: 'mainType', index:'MAIN_TYPE',width: 80,
                        formatter: function (value) {
                            if (value == "" || value == "null" || value == null) {
                                return "";
                            } else {
                                return sysEnums.MAINTENPLAN_TYPE[value];
                            }
                        }
                    },
                    { label: '月份', name: 'monthNum', index:'MONTH_NUM', width: 80 },
                    { label: '日期', name: 'dayNum', index:'DAY_NUM', width: 80 },
                    {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
                ]
            })
        })

        var vm = new Vue({
            el: '#rrapp',
            data: {
                showList: true,
                title: null,
                day: [],
                dayDom: '',
                weeklyDay: '',

                quarterData: '',
                quarterDay: 1,
                quarterDom: '',

                halfYearData: '',
                halfYearDay: 1,
                halfYearList: [],
                halfYearDom: '',

                yearplData: '',
                yearplDay: 1,
                yearplList: [],
                yearplDom: '',

                weekly: '',
                deWeekly: '',
                quarter: '',
                halfYear: '',
                yearpl: '',
                tabsName: '0',
                title_plan: '',
                devMaintenPlan: {},
                typeList: enumsToList('MAINTENPLAN_TYPE'),//类型
            },
            methods: {
                tabsPage:function(e) {
                    vm.tabsName = e
                }
            }
        });
        var monthtime = function (e, n) {
            let str = ''
            if (flg == 'true') {
                str = 'disabled'
            } else {
                str = ''
            }
            let weekly = ''
            for (let i = 1; i < n; i++) {
                if (i == e) {
                    weekly += '<option selected class="op" value=' + i + ' >' + i + '</option>'
                } else {
                    weekly += '<option class="op" value=' + i + ' >' + i + '</option>'
                }
            }
            let dayDom = '<select ' + str + ' onmousemove="onmousemoves(this)" onchange="weeklypl(this.options[this.options.selectedIndex].value,this)"  class="ivu-input select-dom" placeholder="执行日期" style="width:100px">' +
                weekly +
                '</select>'
            weeklypl = function (val, dom) {
                dom.parentElement.previousElementSibling.innerHTML = val
            }
            return dayDom
        }

        var onmousemoves = function (e) {
            e.parentElement.setAttribute('title', '')
        }
    </script>
</body>

</html>
